package com.ysd.dao.impl;

import java.util.ArrayList;

import com.ysd.entity.User;
import com.ysd.util.DBHelper;
import com.ysd.util.DataResult;

public class UserDaoImpl {
	
	
	public ArrayList<User> selectAll(){
		ArrayList<User> lis=new ArrayList<User>();
		String sql="select * from login";	
		try {
			DataResult dr= DBHelper.executeQuery(sql);
			while(dr.rs.next()) {				
				User u=new User();
				u.setId(dr.rs.getInt("id"));
				u.setUsername(dr.rs.getString("username"));
				u.setPassword(dr.rs.getString("password"));
				u.setPhone(dr.rs.getString("phone"));
				u.setEmail(dr.rs.getString("Email"));
				lis.add(u);
			}
			dr.closeAll();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			return lis;
		}
	}
}
